package com.ldp.designpatterns.review.structure.proxy.JdkProxy.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @ClassName JdkProxy
 * @Description TODO
 * @Author lindipei
 * @Date 2023/10/20 18:31
 */
public class JdkProxy implements InvocationHandler {
    private Object bean;
    public JdkProxy(Object bean) {
        this.bean=bean;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        String methodName=method.getName();
        if(methodName.equals("rentHouse")){
            return method.invoke(bean,args);
        }
        return null;
    }
}
